package com.example.springboot_mongo.util;

import java.time.LocalDate;
import java.time.LocalTime;
import java.time.format.DateTimeFormatter;
import java.util.HashMap;

public class TableUtil {
    /**
     * 当前月份
     */
    public static int month = LocalDate.now().getMonth().getValue();

    /**
     * 获取当前几点(12小时制)
     * @return
     */
    public static int getHourFor12() {
        DateTimeFormatter dateTimeFormatter = DateTimeFormatter.ofPattern("hh:mm");
        String now = LocalTime.now().format(dateTimeFormatter);
        int hour_12 = LocalTime.parse(now).getHour();
        return hour_12;
    }

    /**
     * 分表map
     * 按月分12张表 user_1...user_12
     */
    public static HashMap<Integer, String> user_tableMap = new HashMap<>();

    static {
        for (int i = 1; i <= 12; i++) {
            user_tableMap.put(i, "user_" + i);
        }

    }
}
